package training;

import java.util.Scanner;
// https://www.nowcoder.com/questionTerminal/2d3f6ddd82da445d804c95db22dcc471?orderByHotValue=1&page=1&onlyReference=false
// 注意类名必须为 test.Main, 不要有任何 package xxx 信息
public class Day2_02 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        int n = in.nextInt();
        int[] arr = new int[n];
        for(int i = 0; i < n; i++){
            arr[i] = in.nextInt();
        }
        int count = 0;
        int i = 0;
        while(i < arr.length-1){
            if(arr[i] < arr[i+1]){
                while(i < arr.length - 1 && arr[i] <= arr[i+1]){
                    i++;
                }
                count++;
                i++;
                continue;
            } else if(arr[i] == arr[i+1]){
                while(i < arr.length - 1 && arr[i] == arr[i+1]){
                    i++;
                }
                if(i >= arr.length - 1){
                    count++;
                    break;
                }
                continue;
            }
            while(i < arr.length - 1 && arr[i] >= arr[i+1]){
                i++;
            }
            count++;
            i++;
        }
        if(i == arr.length - 1) {
            if (!((arr[i - 2] >= arr[i - 1] && arr[i - 1] >= arr[i]) || (arr[i - 2] <= arr[i - 1] && arr[i - 1] <= arr[i]))) {
                count++;
            }
        }
        System.out.print(count);
    }
}